<template>
<div>
   <ProForm ref="dialogForm" :config="addeditConfig" :echo="echo">
    
   </ProForm>
             <!-- <el-button>取消</el-button>
          <el-button type="primary" @click="confirm" color="#081F42">
            確定
          </el-button> -->
</div>
</template>

<script setup>
import { ref ,watch,onMounted ,nextTick } from 'vue' 
import {addeditConfig} from './formConfig'
import {message,messageBox,loading,closeLoading} from '@/common/function.js'
import bus from '@/common/bus.js'

const props = defineProps({
  echo:Object,
  courseList:Object,
  teacherSelect:Object,
  classroomSelect:Object
})
console.log(props.teacherSelect);
addeditConfig.formItems.find((e) => e.props.label =='課程分類').options = props.courseList
addeditConfig.formItems.find((e) => e.props.label =='教練').options = props.teacherSelect
addeditConfig.formItems.find((e) => e.props.label =='上課教室').options = props.classroomSelect

watch(()=>props.courseList,(newval,oldval)=>{
  // console.log(newval);
  addeditConfig.formItems.find((e) => e.props.label =='課程分類').options = newval
},{immediate:true})

watch(()=>props.teacherSelect,(newval,oldval)=>{
  addeditConfig.formItems.find((e) => e.props.label =='教練').options = newval
  console.log(newval);
},{immediate:true})

watch(()=>props.classroomSelect,(newval,oldval)=>{
  addeditConfig.formItems.find((e) => e.props.label =='上課教室').options = newval
},{immediate:true})


const dialogForm = ref(null);
const DialogCofirm = (cb) => {
  dialogForm.value.submit((e) => {
        cb(e);
  });
};

defineExpose({
    DialogCofirm,
})
</script>

<style lang='less'  scoped>

</style>